# 导包
import requests
import config


# 创建接口类
class StaffAPI:
    # 初始化
    def __init__(self):
        self.url_insert = config.BASE_URL + "/api/sys/user"
        self.url_other = config.BASE_URL + "/api/sys/user/{}"

    # 员工添加
    def insert_staff(self, test_data, token666):
        return requests.post(url=self.url_insert, json=test_data, headers={"Authorization": token666})

    # 员工查询
    def select_staff(self, token666, staff_id):
        return requests.get(url=self.url_other.format(staff_id), headers={"Authorization": token666})

    # 员工修改
    def update_staff(self, token666, staff_id, test_data):
        return requests.put(url=self.url_other.format(staff_id), headers={"Authorization": token666}, json=test_data)

    # 员工删除
    def delete_staff(self, token666, staff_id):
        return requests.delete(url=self.url_other.format(staff_id), headers={"Authorization": token666})
